package org.jeecg.modules.paycenter.channel.tonglian;

import org.jeecg.modules.paycenter.enums.PayChannelEnum;
import org.jeecg.modules.paycenter.service.BaseBankService;
import org.jeecg.modules.wlhy.bill.entity.HyShippingNoteBill;
import org.jeecg.modules.wlhy.tlaccount.service.IHyTlAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.TreeMap;

@Service
public class TongLianPayService extends BaseBankService {

    @Autowired
    private IHyTlAccountService tlAccountService;

    @Autowired
    private TongLianWalletService walletService;


    public String getChannel() {
        return PayChannelEnum.TONGLIAN.channelType;
    }

    public PayChannelEnum getChannelEnum() {
        return PayChannelEnum.TONGLIAN;
    }

    //endregion

    //region  支付回调
    @Transactional
    public void payShippingNoteCallback(String billNum,TreeMap<String, String> map) {
        HyShippingNoteBill bill = hyShippingNoteBillService.getByBillNumForUpdate(billNum);
        if(bill == null){
            return;
        }
        String payInterfaceOutTradeNo = map.get("payInterfaceOutTradeNo");
//        bill.setRxtInfo(payInterfaceOutTradeNo);
//        hyShippingNoteBillService.updateById(bill);
        hyShippingNoteBillService.updateRxtInfoById(bill.getId() , payInterfaceOutTradeNo);
    }



    //endregion
}
